package com.zhkj.txg.module.login.model

import com.zhkj.lib.http.BaseApiService
import com.zhkj.lib.http.BaseResponse
import com.zhkj.txg.module.login.entity.*
import io.reactivex.Observable
import retrofit2.http.*

interface LoginApi : BaseApiService {

    @GET("api/sms/send")
    fun sendCode(
        @Query("mobile") mobile: String,
        @Query("event") event: String
    ): Observable<SendCodeResponse>

    @GET("api/user/mobilelogin")
    fun mobileLogin(
        @Query("mobile") mobile: String,
        @Query("captcha") captcha: String
    ): Observable<LoginResponse>

    @GET("api/article/userAgreement")
    fun userAgreement(): Observable<UserAgreementResponse>

    @FormUrlEncoded
    @POST("api/user/bindInvite")
    fun bindInvite(
        @Field("token") token: String,
        @Field("code") code: String
    ): Observable<BaseResponse>

    @FormUrlEncoded
    @POST("api/user/third")
    fun thirdLogin(@Field("platform") platform: String, @Field("code") code: String): Observable<ThirdLoginResponse>

    @FormUrlEncoded
    @POST("api/user/bindMobile")
    fun bindMobile(
        @Field("token") token: String,
        @Field("mobile") mobile: String,
        @Field("captcha") captcha: String
    ): Observable<LoginResponse>

    @FormUrlEncoded
    @POST("api/user/changeMobile")
    fun changeMobile(
        @Field("token") token: String,
        @Field("mobile") mobile: String,
        @Field("captcha") captcha: String
    ): Observable<BaseResponse>

    @GET("api/index/bootAd")
    fun splashAd(@Query("token") token: String): Observable<SplashAdResponse>

    @FormUrlEncoded
    @POST("api/index/getBanner")
    fun getBanner(
        @Field("token") token: String,
        @Field("shop_id") shop_id: String,
        @Field("type") type: String
    ): Observable<BannerResponse>

}